﻿// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace SnapObjects.Data.PostgreSql
{
    internal class PostgreSqlProcedureColumnSchemaProvider : ProcedureColumnSchemaProvider
    {
        public PostgreSqlProcedureColumnSchemaProvider(DataContext dataContext) : base(dataContext)
        {
        }

        protected override Type ColumnDataType(DataRow row, IDataReader reader)
        {
            var type = base.ColumnDataType(row, reader);

            if (type == typeof(BitArray) && this.ColumnSize(row, reader) == 1)
            {
                return typeof(bool);
            }

            return type;
        }
    }
}
